<?xml version="1.0" encoding="UTF-8"?>
<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:f="http://java.sun.com/jsf/core">
    <h:head>
        <title>Facelet Title</title>

    </h:head>
    <h:body>
        <ui:composition template="/template.xhtml">
             <ui:define name="title">
            Dialog
         </ui:define>
            <ui:define name="content">
                  <c:if test="#{userBean.curentUser == null}">
                    Вы не авторизировались. Авторизируйтесь!
                </c:if> 
                  <c:if test="#{userBean.curentUser != null}">
                      <h3>Входящие:</h3>
                      <h:dataTable id="userMess" headerClass="table-header" rowClasses="table-row" value="#{userBean.curentUser.messagesCollectionInput}" var="o" >                         
                          
                          <h:column>
                              <f:facet name="header">Автор</f:facet>
                              #{o.idUserFrom.name}  
                          </h:column>
                          <h:column>
                              <f:facet name="header">Дата</f:facet>
                              #{o.dateTime}     
                          </h:column>
                          <h:column>
                              <f:facet name="header">Текст</f:facet>
                              #{o.text}     
                          </h:column>
                          <h:column>
                              <h:form>
                                  <h:commandButton id="delete" value="delete" actionListener="#{messageBean.deleteMess}">
                                       <f:attribute name="message" value="#{o}"/>
                                   
                                  </h:commandButton>
                              </h:form>
                          </h:column>
                      </h:dataTable>
                </c:if> 
            </ui:define>
        </ui:composition>
            
</h:body>

</html>

